package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.LeaveMapper;
import com.ruoyi.system.domain.Leave;
import com.ruoyi.system.service.ILeaveService;

/**
 * 活动请假条增删改查Service业务层处理
 * 
 * @author hyb
 * @date 2023-02-26
 */
@Service
public class LeaveServiceImpl implements ILeaveService 
{
    @Autowired
    private LeaveMapper leaveMapper;

    /**
     * 查询活动请假条增删改查
     * 
     * @param id 活动请假条增删改查主键
     * @return 活动请假条增删改查
     */
    @Override
    public Leave selectLeaveById(Long id)
    {
        return leaveMapper.selectLeaveById(id);
    }

    /**
     * 查询活动请假条增删改查列表
     * 
     * @param leave 活动请假条增删改查
     * @return 活动请假条增删改查
     */
    @Override
    public List<Leave> selectLeaveList(Leave leave)
    {
        return leaveMapper.selectLeaveList(leave);
    }

    /**
     * 新增活动请假条增删改查
     * 
     * @param leave 活动请假条增删改查
     * @return 结果
     */
    @Override
    public int insertLeave(Leave leave)
    {
        leave.setCreateTime(DateUtils.getNowDate());
        return leaveMapper.insertLeave(leave);
    }

    /**
     * 修改活动请假条增删改查
     * 
     * @param leave 活动请假条增删改查
     * @return 结果
     */
    @Override
    public int updateLeave(Leave leave)
    {
        leave.setUpdateTime(DateUtils.getNowDate());
        return leaveMapper.updateLeave(leave);
    }

    /**
     * 批量删除活动请假条增删改查
     * 
     * @param ids 需要删除的活动请假条增删改查主键
     * @return 结果
     */
    @Override
    public int deleteLeaveByIds(Long[] ids)
    {
        return leaveMapper.deleteLeaveByIds(ids);
    }

    /**
     * 删除活动请假条增删改查信息
     * 
     * @param id 活动请假条增删改查主键
     * @return 结果
     */
    @Override
    public int deleteLeaveById(Long id)
    {
        return leaveMapper.deleteLeaveById(id);
    }
}
